set more off
capture log close
cd *** Fill in path name here ***

//  program:    AnanatEtAl_suicidality results
//  task:		Regressions of suicidal ideation on job loss -- including state-specific linear trends

log using *** Fill in file name here ***, replace text

// Run this sensitivity check for black youth only 

// #1
// Load data
use AnanatEtAl_suicidality_data.dta, clear

keep if black == 1

// #2
// Indicate data is weighted
svyset psu [pweight=weight], strata(stratum)  singleunit(certainty) 

// #3 
// Create state-specific linear trends
sort state year

qui for var std*: gen Xtrend=X*year

// #4
// Run IV-probit regressions, addressing the complex survey design, black youth only

svy: ivprobit suicthtly (seppctyrlag = ticpctyrlag) age female yrd* std*
margins, dydx (seppctyrlag) predict (pr)

clear

log close
